package org.zju.demo.service.impl;

import org.zju.demo.model.CarStatus;
import org.zju.demo.service.intf.CarStatusIntf;
import org.zju.demo.utils.HibernateUtil;

import java.util.List;

/**
 * Created by ZJDX on 2015/9/17.
 */
public class CarStatusService implements CarStatusIntf {
    public List<CarStatus> query(int id) {
        String hql = "from CarStatus where id = ?";
        String[] paramters = {Integer.toString(id)};
        return HibernateUtil.executeQuery(hql, paramters);
    }

    public List<CarStatus> query(int id, int n) {
        String hql = "from CarStatus where id = ?";
        String[] parameters = {Integer.toString(id)};
        return HibernateUtil.executeQueryFinalNRecords(hql, parameters, n);
    }

    public void add(CarStatus carStatus) {
        HibernateUtil.save(carStatus);
    }
}
